<template>
  <div style="position: relative">
    <div class="content">
      <div class="info">
        <div class="title">{{ basicInfo.title }}</div>
        <div class="list">
          <div class="item">
            <div class="tit">创建时间</div>
            <div class="desc">
              {{ detailsInfo.gmtCreated ? detailsInfo.gmtCreated : "-" }}
            </div>
          </div>
          <div class="item">
            <div class="tit">商户订单号</div>
            <div class="desc">
              {{ detailsInfo.payformNo ? detailsInfo.payformNo : "-" }}
            </div>
            <div
              v-if="detailsInfo.payformNo"
              style="
                margin-left: 32px;
                color: #03bfc6;
                line-height: 40px;
                cursor: pointer;
              "
            >
              <i
                class="el-icon-document-copy"
                @click="copyAppId(detailsInfo.payformNo)"
              ></i>
            </div>
          </div>
          <div class="item">
            <div class="tit">云尘付流水号</div>
            <div class="desc">
              {{
                detailsInfo.innerPayformNo ? detailsInfo.innerPayformNo : "-"
              }}
            </div>
            <!-- <div
                style="
                  margin-left: 32px;
                  color: #03bfc6;
                  line-height: 40px;
                  cursor: pointer;
                "
              >
                <i
                  class="el-icon-document-copy"
                  @click="copyAppId(detailsInfo.innerPayformNo)"
                ></i>
              </div> -->
          </div>
          <div class="item">
            <div class="tit">订单金额/元</div>
            <div class="desc">
              {{
                detailsInfo.fmtOriginalAmount ? detailsInfo.fmtOriginalAmount : "-"
              }}
            </div>
          </div>
          <div class="item">
            <div class="tit">优惠金额/元</div>
            <div class="desc">
              {{
                detailsInfo.fmtDiscountAmount
                  ? detailsInfo.fmtDiscountAmount
                  : "-"
              }}
            </div>
          </div>
          <div class="item">
            <div class="tit">应付金额/元</div>
            <div class="desc">
              {{
                detailsInfo.fmtActualAmount ? detailsInfo.fmtActualAmount : "-"
              }}
            </div>
          </div>
          <div class="item">
            <div class="tit">订单状态</div>
            <div class="desc">
              {{ detailsInfo.payStatusName ? detailsInfo.payStatusName : "-" }}
            </div>
          </div>
          <!-- <div class="item">
              <div class="tit">支付状态</div>
              <div class="desc">{{ detailsInfo.gmtCreated }}</div>
            </div> -->
          <!-- <div class="item">
              <div class="tit">付款方</div>
              <div class="desc">{{ detailsInfo.gmtCreated }}</div>
            </div> -->
          <div class="item">
            <div class="tit">收款方</div>
            <div class="desc">
              {{ detailsInfo.memberName ? detailsInfo.memberName : "-" }}
            </div>
          </div>
          <div class="item">
            <div class="tit">商品名称</div>
            <div class="desc">
              {{ detailsInfo.subject ? detailsInfo.subject : "-" }}
            </div>
          </div>
        </div>
      </div>
      <div class="info">
        <div class="title">{{ payInfo.title }}</div>
        <div class="list">
          <div class="item">
            <div class="tit">支付时间</div>
            <div class="desc">
              {{ detailsInfo.payTime ? detailsInfo.payTime : "-" }}
            </div>
          </div>
          <div class="item">
            <div class="tit">支付渠道</div>
            <div class="desc">
              {{
                detailsInfo.channelPayFormTypeName
                  ? detailsInfo.channelPayFormTypeName
                  : "-"
              }}
            </div>
          </div>
          <div class="item">
            <div class="tit">渠道流水号</div>
            <div class="desc">
              {{ detailsInfo.thirdOrderNo ? detailsInfo.thirdOrderNo : "-" }}
            </div>
          </div>
          <div class="item">
            <div class="tit">支付金额/元</div>
            <div class="desc">
              {{
                detailsInfo.fmtActualAmount ? detailsInfo.fmtActualAmount : "-"
              }}
            </div>
          </div>
          <div class="item">
            <div class="tit">渠道手续费/元</div>
            <div class="desc">
              {{ detailsInfo.fmtFeeAmount ? detailsInfo.fmtFeeAmount : "-" }}
            </div>
          </div>
          <div class="item">
            <div class="tit">退款情况</div>
            <div class="desc">
              {{
                detailsInfo.refundStateName ? detailsInfo.refundStateName : "-"
              }}
            </div>
          </div>
          <div class="item">
            <div class="tit">退款金额/元</div>
            <div class="desc" v-if="detailsInfo.refundStateName!='无退款'">
              {{
                detailsInfo.fmtRefundAmount ? detailsInfo.fmtRefundAmount : "-"
              }}
            </div>
            <div class="desc" v-else>-</div>
          </div>
        </div>
      </div>
      <div class="info infos">
        <div class="title">{{ merchantInfo.title }}</div>
        <div class="list">
          <div class="item">
            <div class="tit">分账规则</div>
            <div class="desc">
              {{ detailsInfo.ruleName ? detailsInfo.ruleName : "-" }}
            </div>
          </div>
          <div class="item">
            <div class="tit">结算总金额/元</div>
            <div class="desc">
              {{
                detailsInfo.fmtTotalSettleAmount
                  ? detailsInfo.fmtTotalSettleAmount
                  : "-"
              }}
            </div>
          </div>
          <div class="item">
            <div class="tit">结算方</div>
            <div>
              <div
                v-for="(item, idx) of detailsInfo.payformSettleList"
                :key="idx"
                class="desc settleDesc"
              >
                <div class="tipBox">
                  <el-tooltip
                    class="item"
                    effect="dark"
                    :content="item.settleMemberName"
                    placement="top"
                  >
                    <p class="sMn">
                      {{ item.settleMemberName }}
                    </p>
                  </el-tooltip>
                </div>
                &nbsp;&nbsp;
                <span style="color: #03bfc6">￥{{ item.fmtSettleAmount }}</span>
                &nbsp;&nbsp;
                <span>{{
                  item.settleFinish == "1" ? "已结算" : "未结算"
                }}</span>
              </div>
            </div>
          </div>
          <div class="item">
            <div class="tit">手续费承担方</div>
            <div class="desc">
              {{ findFeeName(detailsInfo.payformSettleList) }}
            </div>
          </div>

          <!-- <div class="item">
              <div class="tit">结算方式</div>
              <div class="desc">
                  test
              </div>
            </div> -->
        </div>
      </div>
    </div>
    <div class="back" @click="backFn">
      <i class="el-icon-close"></i>
    </div>
    <div class="left">
      <el-breadcrumb separator=">" style="margin-bottom: 20px">
        <el-breadcrumb-item v-for="item of breadList" :key="item">{{
          item
        }}</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
  </div>
</template>

<script>
export default {
  name: "caseAccountDetail",
  components: {},
  data() {
    return {
      breadList: [],
      detailsInfo: {},
      basicInfo: {
        title: "基本信息",
        infoList: [
          {
            title: "创建时间",
            data: "2023-01-23 14:00",
          },
          {
            title: "商户订单号",
            data: "87930235949282",
          },
          {
            title: "云尘付流水号",
            data: "YC739008937420535",
          },
          {
            title: "订单状态",
            data: "正常",
          },
          {
            title: "支付状态",
            data: "已支付",
          },
          {
            title: "付款方",
            data: "Chiweoe",
          },
          {
            title: "服务方",
            data: "奥力驾停车场",
          },
          {
            title: "商品名称",
            data: "商品名称可能有点长没错就是这样子商品名称",
          },
          {
            title: "订单金额",
            data: "230.00",
          },
          {
            title: "优惠金额",
            data: "0.00",
          },
          {
            title: "应付金额",
            data: "230.00",
          },
        ],
      },
      payInfo: {
        title: "支付信息",
        infoList: [
          {
            title: "支付时间",
            data: "2023-01-23 14:00",
          },
          {
            title: "支付渠道",
            data: "汇付",
          },
          {
            title: "支付金额",
            data: "230.00",
          },
          {
            title: "渠道流水号",
            data: "523223215115",
          },
          {
            title: "是否退款",
            data: "否",
          },
          {
            title: "退款金额",
            data: "-",
          },
        ],
      },
      merchantInfo: {
        title: "结算信息",
        infoList: [
          {
            title: "分账规则",
            data: "523223215115",
          },
          {
            title: "结算总金额",
            data: "230.00",
          },
          {
            title: "结算方",
            data: "奥立驾有限责任公司",
          },
          {
            title: "手续费",
            data: "1.00",
          },
          {
            title: "是否结算",
            data: "是",
          },
          {
            title: "结算方式",
            data: "结算到余额",
          },
        ],
      },
    };
  },
  created() {
    this.breadList = this.$route.meta.title;
    //console.log(this.$route.query.id);
    let id = this.$route.query.id;
    if (id) {
      this.$http
        .get(`/api/settle/payout/getSettleDetailById?id=${id}`)
        .then((res) => {
          if (res.code === "0000") {
            //console.log(res.data);
            this.detailsInfo = res.data;
          }
        });
      // this.$http
      //   .post("/api/settle/payout/getSettleDetailById", {
      //     id,
      //   })
      //   .then((res) => {
      //     if (res.code === "0000") {
      //       console.log(res.data);
      //       // this.info = res.data;
      //     }
      //   });
    }
  },
  methods: {
    backFn() {
      this.$backTo("/caseAccount/caseAccountDetails");
    },
    findFeeName(arr) {
      let obj = arr && arr.length && arr.find((item) => item.feeFlag == "Y");
      if (obj) {
        return obj.settleMemberName;
      }
    },
    copyAppId(value) {
      const input = document.createElement("input"); // 创建input对象
      input.value = value; // 设置复制内容
      document.body.appendChild(input); // 添加临时实例
      input.select(); // 选择实例内容
      document.execCommand("Copy"); // 执行复制
      document.body.removeChild(input); // 删除临时实例
      this.$message.success("复制成功！");
    },
  },
};
</script>

<style scoped lang="scss">
.content {
  min-height: 780px;
  padding: 100px 100px;
  display: flex;
  justify-content: space-around;
  .info {
    width: 368px;
    .title {
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #1d1c1c;
      padding-bottom: 15px;
      border-bottom: 1px solid #03bfc6;
    }
    .list {
      margin-top: 35px;
      .item {
        display: flex;
        .tit {
          min-width: 84px;
          margin-right: 32px;
          font-size: 14px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #869daa;
          line-height: 40px;
          text-align: right;
        }
        .desc {
          font-size: 14px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #1d1c1c;
          line-height: 40px;
        }
      }
    }
    &.infos {
      width: 450px;
    }
  }
}
.back {
  position: absolute;
  right: 55px;
  top: 20px;
  font-size: 20px;
  cursor: pointer;
}
.left {
  position: absolute;
  left: 55px;
  top: 31px;
  height: 20px;
  font-size: 14px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #869daa;
  line-height: 20px;
}
.settleDesc {
  display: flex;
}
.tipBox {
  max-width: 213px;
  height: 40px;

  .sMn {
    width: 100%;
    display: inline-block !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
  }
}

// :deep(.el-table__expand-icon) {
//   // position: absolute;
//   // left:140px;
//   float: left;
// }
</style>
